package 字符串最后一个单词的长度;

import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String str=sc.nextLine();
        int n=str.length();
        int index=-1;
        for (int i = n-1; i >=0; i--)
        {
            if (i==n-1&&str.charAt(i)==' ')
                continue;
            else if (str.charAt(i)==' ')
            {
                index=i;
                break;
            }
        }
        System.out.println(n-index-1);
    }
}
